package com.woniu.micropropertyserver.housemag.mapper;

import com.woniu.microcommonsserver.entity.HouseChangeInfoEntity;
import com.woniu.microcommonsserver.entity.HouseInfoEntity;
import com.woniu.microcommonsserver.param.PageRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2021/2/1
 * @description：房产mapper
 */
@Mapper
public interface HouseMapper {
    /**
     * 条件查询所有房间信息
     * @return
     */
    List<HouseInfoEntity> findBy(@Param("p") PageRequest request, @Param("house")HouseInfoEntity houseInfoEntity);

    /**
     * 条件查询所有房间变更信息
     * @return
     */
    List<HouseChangeInfoEntity> findChange(@Param("hid")String id);

    /**
     * 绑定
     * @return
     */
    void bind(@Param("hid")String hid,@Param("uid")String uid,@Param("name")String name,@Param("phone")String phone);

    /**
     * 取绑
     * @return
     */
    void unbind(@Param("hid")String hid);

    /**
     * 换绑
     * @return
     */
    void cBind(@Param("hid")String hid,@Param("uid")String uid,@Param("name")String name,@Param("phone")String phone);

    /**
     * 添加记录
     * @return
     */
    void addChange(@Param("hc")HouseChangeInfoEntity houseChangeInfoEntity);

    @ResultType(HouseInfoEntity.class)
    @Select("select id,name,fk_space_id fkSpaceId,high,build_covered buildCovered,use_covered useCovered,status,fk_user_id fkUserId,user_name userName from house_info where fk_user_id =#{cardId}")
    List<HouseInfoEntity> findByOid(String  cardId);

}
